import request from '@/utils/request'

export function baseAttrListBySpuId(spuId) {
  return request({
    url: `/product/productAttrValue/listBySpuId/${spuId}`,
    method: 'get',
  })
}

export function getById(attrId) {
  return request({
    url: `/product/attr/getById/${attrId}`,
    method: 'get',
  })
}

export function findAttr(params) {
  return request({
    url: `/product/attr/find`,
    method: 'get',
    params
  })
}

export function saleAttrListByCategoryId(categoryId) {
  return request({
    url: '/product/attr/list',
    method: 'get',
    params: {
      categoryId,
      attrType: 0
    }
  })
}

export function saveAttr(data) {
  return request({
    url: `/product/attr/save`,
    method: 'post',
    data
  })
}

export function updateAttr(data) {
  return request({
    url: `/product/attr/update`,
    method: 'post',
    data
  })
}

export function updateAttrBySpuId(data,spuId) {
  return request({
    url: `/product/attr/update/${spuId}`,
    method: 'post',
    data
  })
}

export function deleteAttr(ids) {
  return request({
    url: `/product/attr/delete`,
    method: 'post',
    data: ids
  })
}

